//
//  RotateCollectionViewController.swift
//  CollectionViewUsage
//
//  Created by han on 2020/5/14.
//  Copyright © 2020 han. All rights reserved.
//

import UIKit

private let reuseIdentifier = "RotateCell"

class RotateCollectionViewController: UICollectionViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let rotate = RotateFlowLayout()
        rotate.scrollDirection = .horizontal
        rotate.itemSize = CGSize(width: 300, height: 500)
        rotate.minimumLineSpacing = 0
        collectionView.collectionViewLayout = rotate
    }

    override func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }


    override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 20
    }

    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath)
        cell.contentView.backgroundColor = UIColor.init(red: CGFloat(arc4random()%255)/255, green: CGFloat(arc4random()%255)/255, blue: CGFloat(arc4random()%255)/255, alpha: 1)
        return cell
    }

}
